 <template>
  <!-- 详细内容页面 -->
  <div id="container">
    <el-collapse v-model="activeNames" v-loading="loading">
      <el-collapse-item title="基本信息" name="1">
        <loan-detail ref="detail" :form="loanData"></loan-detail>
      </el-collapse-item>
      <el-collapse-item title="审批流程" name="2">
        <check-process
          ref="checkProcess"
          :id="$route.query.id"
          :type="9"
        ></check-process>
      </el-collapse-item>
    </el-collapse>
    <auth-buttons
      :info="{ type: 9, mainId: $route.query.id }"
      @updatePage="updatePage"
    ></auth-buttons>
  </div>
</template>
<script>
import loanDetail from './components/loanDetail.vue'
import checkProcess from '@/components/checkProcess/checkList'
import authButtons from '@/components/authButtons'
import { queryTypeByDic } from '@/utils/getData'
export default {
  name: 'detail',
  data () {
    return {
      activeNames: ['1'],
      checkCofig: [],
      loanData: {},
      typeList: [],
      loading: false
    }
  },
  components: {
    loanDetail,
    checkProcess,
    authButtons
  },
  mounted () {
    this.getType()

  },
  methods: {
    // 获取支付方式
    async getType () {
      this.typeList = await queryTypeByDic('payment')
      this.getDetail()
    },
    async getDetail () {
      this.loading = true
      let { data } = await this.$API.finance.loanManagement.getLoanDetailById.post({ id: this.$route.query.id })
      this.loanData = data
      this.typeList.forEach(item => {
        if (item.value == this.loanData.payType) {
          this.loanData.payTypeName = item.name
        }
      })
      this.activeNames.push('2')
      this.loading = false
    },
    updatePage () {
      this.getDetail()
      this.$refs.detail.relodPart()
      this.$refs.checkProcess.relodPart()
    }
  }
}
</script>
<style lang='scss' scoped>
#container {
  margin: 10px;
  :deep(.el-collapse-item__header) {
    padding-left: 20px;
    font-size: 16px;
  }
  :deep(.el-collapse-item__content) {
    padding: 0 20px 20px 20px;
  }
  :deep(.el-form-item) {
    margin-bottom: 5px;
  }
  :deep(.el-form-item__label) {
    color: #999;
  }
}
</style>